//
//  LLT_DataViewController_LXM.m
//  CoderLLT
//
//  Created by 刘晓萌 on 15/12/11.
//  Copyright © 2015年 刘晓萌. All rights reserved.
//

#import "LLT_DataViewController_LXM.h"
#import "LLT_SearchPlayerViewController_LXM.h"
#import "LLT_HeroViewController_LXM.h"
#import "LLT_ItemListViewController_LXM.h"
#import "LLT_RankListViewController_LXM.h"
#import "LLT_WeekFreeViewController_LXM.h"
#import "LLT_SearchViewController.h"
@interface LLT_DataViewController_LXM ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@end

@implementation LLT_DataViewController_LXM

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setDelegate];
    self.tabBarController.tabBar.tintColor = [UIColor colorWithRed:255.0/255.0 green:124.0/255.0 blue:56.0/255.0 alpha:1];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


/**
 * 统一设置代理
 */
-(void)setDelegate{
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
}


#pragma mark --- tableView页面数据

/**
 * 有多少行cell
 *
 * @return 行数
 */
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}

/**
 * 有多少session
 *
 * @return session个数
 */
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}


/**
 * 返回特定的cell
 *
 * @return cell
 */
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    switch (indexPath.row) {
        case 0:{
            cell = [tableView dequeueReusableCellWithIdentifier:@"hero_cell" forIndexPath:indexPath];
        }
            break;
        case 1:{
            cell = [tableView dequeueReusableCellWithIdentifier:@"thing_cell" forIndexPath:indexPath];
        }
            break;
        case 2:{
            cell = [tableView dequeueReusableCellWithIdentifier:@"best_cell" forIndexPath:indexPath];
        }
            break;
        case 3:{
            cell = [tableView dequeueReusableCellWithIdentifier:@"weakfree_cell" forIndexPath:indexPath];
        }
            break;
        default:
            break;
    }
    return cell;
}

/**
 * tableviewcell的点击事件
 *
 * @return
 */
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    switch (indexPath.row) {
        case 0:{
            LLT_HeroViewController_LXM *heroVC = [MainStoryBoard instantiateViewControllerWithIdentifier:@"heroVC"];
            [self presentViewController:heroVC animated:YES completion:nil];
        }
            break;
        case 1:{
            LLT_ItemListViewController_LXM *itemListVC = [MainStoryBoard instantiateViewControllerWithIdentifier:@"itemListVC"];
            [self presentViewController:itemListVC animated:YES completion:nil];
        }
            break;
        case 2:{
            LLT_RankListViewController_LXM *rankListVC = [MainStoryBoard instantiateViewControllerWithIdentifier:@"rankListVC"];
            [self presentViewController:rankListVC animated:YES completion:nil];
        }
            break;
        case 3:{
            LLT_WeekFreeViewController_LXM *weekFreeVC = [MainStoryBoard instantiateViewControllerWithIdentifier:@"weekFreeVC"];
            [self presentViewController:weekFreeVC animated:YES completion:nil];
        }
            break;
        default:
            break;
    }
    
}


/**
 *设置分割线顶格
 */
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}

/**
 * 设置cell的高度
 */
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 60;
}

/**
 * 设置电源栏反颜色
 *
 * @return
 */
- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
